package com.zwh.algorithm.foundation;

/**
 * 写个计算机底层实现计算的伪代码
 *
 * @author yexi
 */
public class Basic {

    public static void main(String[] args) {
        //整除
        System.out.println(divide(13, 5));
        //取余
        System.out.println(remainder(13, 5));
    }


    public static int divide(int num1, int num2) {
        //被除数
        int augend = num2;
        int result = 0;
        while (num1 > num2) {
            num2 += augend;
            result++;
        }
        return result;
    }

    private static int remainder(int num1, int num2) {
        while (num1 > num2) {
            num1 -= num2;
        }
        return num1;
    }
}
